package com.duguo.dynamicmvc.view.redirect;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.duguo.dynamicmvc.model.Model;
import com.duguo.dynamicmvc.model.statusmessage.StatusMessageHelper;
import com.duguo.dynamicmvc.model.statusmessage.StatusMessageModel;
import com.duguo.dynamicmvc.view.AbstractView;

public abstract class AbstractRedirectView extends AbstractView {
    
    public void senRedirect(HttpServletRequest request, HttpServletResponse response, Model model,String url) throws Exception{
    	if(model instanceof StatusMessageModel){
    		StatusMessageHelper.saveStatusMessage(request, (StatusMessageModel)model);
    	}
    	response.sendRedirect(url);
    }
}
